Public Class clsOfflines
    'local variable(s) to hold property value(s)
    Private sMessageHeader As String 'local copy
    Private sMessageText As String 'local copy
    Public Function formatMSG(ByVal sData As String) As String
        'Dim from As String, time As String, x As Integer, iLength As Integer, sLength As String
        sData = sData.Substring(sData.IndexOf("OFFLINEFROM_") + 12)
        Dim x As Int32 = 1
        'Do Until Mid(sData, x, 1) = "@"
        'from = from + Mid(sData, x, 1)
        'x = x + 1
        'Loop
        Dim from As String = sData.Substring(0, sData.IndexOf("@"))
        sData = sData.Substring(from.Length + 1)
        'x = x + 1
        'Do Until Mid(sData, x - 1, 1) = "M" And Mid(sData, x, 1) = ":"
        'time = time + Mid(sData, x, 1)
        'x = x + 1
        'Loop
        Dim time As String = sData.Substring(0, sData.IndexOf("M:") + 1)
        sData = sData.Substring(time.Length + 1)
        'x = x + 2
        'Do Until Mid(sData, x, 1) = "{"
        'sLength = sLength + Mid(sData, x, 1)
        'x = x + 1
        'Loop
        Dim sLength As String = sData.Substring(0, sData.IndexOf("{"))
        Dim iLength As Int32 = Val(sLength)
        sData = sData.Substring(sLength.Length + 1)
        'x = x + 1
        Me.Message = sData.Substring(0, iLength)  'Right(sData, Len(sData) - x)
        'x = x + 1
        Me.MessageHeader = "FROM: " + from + "     AT: " + time
        formatMSG = sData.Substring(iLength + 1)
    End Function
    Public Property Message()
        Get
            Message = sMessageText
        End Get
        Set(ByVal Value)
            sMessageText = Value
        End Set
    End Property
    Public Property MessageHeader()
        Get
            MessageHeader = sMessageHeader
        End Get
        Set(ByVal Value)
            sMessageHeader = Value
        End Set
    End Property
End Class
